﻿namespace WMS6.Web.CrossDock
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class LaneQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlLaneIDOper;
        protected DropDownList ddlLaneSeqOper;
        protected DropDownList ddlLaneType;
        protected DropDownList ddlLaneTypeOper;
        protected HtmlForm F79610;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lbllane;
        protected Label lblLaneID;
        protected Label lblLaneSeq;
        protected Label lblLaneType;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtLaneID;
        protected TextBox txtLaneSeq;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LaneList.aspx?action={0}&from=list", this.hdnActionID.Value.Trim()), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LaneList.aspx?action={0}", this.hdnActionID.Value.Trim()), false);
        }

        private void InitDropDownLists()
        {
            base.BindData2DDLBySysCode(this.ddlLaneType, "LaneType");
            this.ddlLaneType.Items.Insert(0, new ListItem("-----", "", true));
            base.InitQueryDDL(this.ddlLaneIDOper, 0);
            base.InitQueryDDL(this.ddlLaneSeqOper, 0);
            base.InitQueryDDL(this.ddlLaneTypeOper, 0);
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnNew.Visible = false;
                this.btnExport.Visible = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.InitDropDownLists();
            }
        }

        public string LaneID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLaneID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLaneID.Text.Trim(), this.ddlLaneTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string LaneSeq
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLaneSeq.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLaneSeq.Text.Trim(), this.ddlLaneSeqOper.SelectedValue);
                }
                return "";
            }
        }

        public string LaneType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlLaneType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlLaneType.SelectedValue, this.ddlLaneTypeOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

